Ext.define('ZO0.view.filter.TreeCategory', {
    extend: 'Ext.tree.Panel',
    alias: 'widget.filtertreecategory',

    store: 'filter.Tree',

    rootVisible: false,
    useArrows: true,
    hideHeaders: false,

    initComponent: function() {

        Ext.apply(this, {
            viewConfig: { toggleOnDblClick: false },
            columns: [
                { xtype: 'treecolumn', header: 'Category', dataIndex: 'name', flex: 1, tooltip: 'Category Name' }
            ],
            listeners: {
                itemdblclick: this.onDoubleClick
            }
        });

        this.callParent();
    },
    onDoubleClick: function(node, record) {
        //console.info('itemdblclick node=',node,' record=',record);
        var store2 = Ext.getStore('filter.Vendors');
        store2.getProxy().setExtraParam('cid', record.data.cid);
        store2.on({
            load: {
                scope: store2,
                single: true,
                fn: function() {
                    this.createSubcategoryTable(record.data.name);
                }
            }
        });
        store2.loadPage(1);
    }
});
